package db

import (
	"fmt"
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
	"gorm.io/gorm/schema"
)

var dbCon *gorm.DB

func init() {
	con, err := gorm.Open(mysql.Open(DSN), &gorm.Config{
		NamingStrategy: schema.NamingStrategy{
			SingularTable: true,
		},
	})
	if err != nil {
		fmt.Printf("连接mysql失败")
	}

	dbCon = con

	fmt.Println("===========> 连接mysql成功")
}

func GetBbCon() *gorm.DB {
	return dbCon
}
